<template>
  <List
    v-model="loading"
    :finished="finished"
    :error="error"
    finished-text="已经到底啦~~"
  >
    <slot />
  </List>
</template>

<script>
import { List } from "vant";

export default {
  components: {
    List
  },
  props: {
    service: {
      type: Object,
      required: true
    }
  },
  setup(props) {
    const { service } = props;

    service.api.load();

    return {
      loading: service.loading,
      finished: service.finished,
      error: !!service.error,
      errorMessage: service.error
    };
  }
};
</script>

<style scoped></style>
